﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace OpenShape
{
    public partial class TableView : Form
    {
        public int Index;
        public string DataTable_Name;

        public TableView(int isID, string Name)
        {
            InitializeComponent();
            Index = isID;
            DataTable_Name = Name;
        }

        private void TableView_Load(object sender, EventArgs e)
        {

            this.dataGridView.Font = new Font("Tahoma", 8);

            BindingSource bindingSource = new BindingSource();
            dataGridView.DataSource = bindingSource;

            this.Text = "속성테이블 : " + DataTable_Name;
  
            bindingSource.DataSource = LayerManager .m_Layers [Index ].m_DBF.pDataTable;

            dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader);
            this.Cursor = Cursors.Default;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void TableView_SizeChanged(object sender, EventArgs e)
        {
            dataGridView.Top = 0;
            dataGridView.Left = 0;
            dataGridView.Width = this.Width-18;
            dataGridView.Height = this.Height - 70;

            button1.Top = this.Height - 65;
            button1.Left = this.Width - 130;
        }
    }
}